//
//  PersonalCenterController.m
//  ManageMoney
//
//  Created by epwk on 15/9/8.
//  Copyright (c) 2015年 db. All rights reserved.
//

#import "PersonalCenterController.h"
#import "AboutUsViewController.h"
#import "UserAgreementController.h"
#import "ServiceCenterController.h"
#import "UserShareController.h"

@interface PersonalCenterController ()
@property (weak, nonatomic) IBOutlet UIButton *aboutUsBtn;
@property (weak, nonatomic) IBOutlet UIButton *serviceBtn;
@property (weak, nonatomic) IBOutlet UIButton *protocolBtn;
@property (weak, nonatomic) IBOutlet UIButton *shareBtn;
@property (weak, nonatomic) IBOutlet UIButton *logoutBtn;

@end

@implementation PersonalCenterController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"用户中心";
}



- (IBAction)userCenterItemAction:(id)sender {
    UIButton *btn = (UIButton *)sender;
    switch (btn.tag) {
        case 0://关于我们
        {
            AboutUsViewController *ctr = [[AboutUsViewController alloc] initWithNibName:@"AboutUsViewController" bundle:nil];
            [self.navigationController pushViewController:ctr animated:YES];
        }
            break;
        case 1://客服中心
        {
            ServiceCenterController *ctr = [[ServiceCenterController alloc] initWithNibName:@"ServiceCenterController" bundle:nil];
            [self.navigationController pushViewController:ctr animated:YES];
        }
            break;
        case 2://用户协议
        {
            UserAgreementController *ctr = [[UserAgreementController alloc] initWithNibName:@"UserAgreementController" bundle:nil];
            [self.navigationController pushViewController:ctr animated:YES];
        }
            break;
        case 3://用户分享
        {
            UserShareController *ctr = [[UserShareController alloc] initWithNibName:@"UserShareController" bundle:nil];
            [self.navigationController pushViewController:ctr animated:YES];
        }
            break;
        case 4://用户退出
        {
            [[NSNotificationCenter defaultCenter] postNotificationName:RefreshUserData object:nil];
            
            [UserDefaults setObject:nil forKey:kUserInfo];
            [UserDefaults setBool:NO forKey:kDidLogin];
            [UserDefaults synchronize];
            
            [self leftBarButtonClick:nil];
            
            [SVProgressHUD showSuccessWithStatus:@"退出成功"];
            
            
        }
            break;
            
        default:
            break;
    }
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
